package com.ruoyi.bus.controller.front;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.bus.domain.BaseOrder;
import com.ruoyi.bus.domain.DissentInfo;
import com.ruoyi.bus.domain.NetworkInfo;
import com.ruoyi.bus.domain.TransUnit;
import com.ruoyi.bus.service.IDissentInfoService;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.bus.service.NoGenerateServlce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/api/dissent")
public class FrontDissentController {

    @Autowired
    private IDissentInfoService dissentInfoService;
    @Autowired
    private NoGenerateServlce noGenerateServlce;

    @Transactional
    @RequestMapping("/add")
    @ResponseBody
    public AjaxResult addAndList(@RequestBody DissentInfo dissentInfo){

        dissentInfo.setDissentId(noGenerateServlce.getSeqNo("DI",5));
        dissentInfo.setDissentStatus("10");
        if(dissentInfoService.save(dissentInfo)){
            return AjaxResult.success();
        }else{
            return AjaxResult.error();
        }
    }
}
